unit MultiClassMethod_cxTreeList;

interface
uses
  {$IF CompilerVersion<16}
  Graphics,
  {$ELSE}
  VCL.Graphics,
  {$IFEND}
  Classes,SysUtils,Variants,
  AcroMultiClassMethod,
  cxTL;

  procedure TcxCustomTreeList_ReplaceNodes(ATable:IDataLocate; AComponent:TcxCustomTreeList; ALCID,ASeqNo:String; AFont:TFont;AParams:TStringList);


implementation

type
  TcxCustomTreeList_Temp=class(TcxCustomTreeList);

procedure TcxCustomTreeList_ReplaceNodes(ATable:IDataLocate; AComponent:TcxCustomTreeList; ALCID,ASeqNo:String; AFont:TFont;AParams:TStringList);
  procedure ReplaceNode(ANode:TcxTreeListNode);
  var
    i: Integer;
  begin
    for i:=0 to TcxCustomTreeList_Temp(AComponent).ColumnCount-1 do
      if VarIsStr(ANode.Values[i]) then
        ANode.Values[i] := GetDisplayValue(ATable,ANode.Values[i], ALCID, ASeqNo,
          ANode,InttoStr(i));
    for i:=0 to ANode.Count-1 do ReplaceNode(ANode.Items[i]);
  end;
var
  i: Integer;
begin
  TcxCustomTreeList_Temp(AComponent).BeginUpdate;
  try
    for i:=0 to TcxCustomTreeList_Temp(AComponent).Count-1 do
      ReplaceNode(TcxCustomTreeList_Temp(AComponent).Items[i]);
  finally
    TcxCustomTreeList_Temp(AComponent).EndUpdate;
  end;
end;

procedure Proc_TcxCustomTreeList(ATable:IDataLocate; AComponent:TObject; ALCID,ASeqNo:String; AParams:TStringList);
var
  i: Integer;
begin
  TcxCustomTreeList_Temp(AComponent).BeginUpdate;
  try
    for i:=0 to TcxCustomTreeList_Temp(AComponent).Bands.Count-1 do
    begin
      TcxCustomTreeList_Temp(AComponent).Bands[i].Caption.Text :=
        GetDisplayValue(ATable,TcxCustomTreeList_Temp(AComponent).Bands[i].Caption.Text, ALCID, ASeqNo,
          TcxCustomTreeList_Temp(AComponent).Bands[i],'Caption');
    end;
    for i:=0 to TcxCustomTreeList_Temp(AComponent).ColumnCount-1 do
    begin
      TcxCustomTreeList_Temp(AComponent).Columns[i].Caption.Text :=
        GetDisplayValue(ATable,TcxCustomTreeList_Temp(AComponent).Columns[i].Caption.Text, ALCID, ASeqNo,
          TcxCustomTreeList_Temp(AComponent).Columns[i],'Caption');
    end;
  finally
    TcxCustomTreeList_Temp(AComponent).EndUpdate;
  end;
end;

procedure BeginUpdateProc_TcxCustomTreeList(AComponent:TObject);
begin
  TcxCustomTreeList(AComponent).BeginUpdate;
end;

procedure EndUpdateProc_TcxCustomTreeList(AComponent:TObject);
begin
  TcxCustomTreeList(AComponent).EndUpdate;
end;

initialization
  AcroClassMethodStorage.RegisterClassMethod(TcxCustomTreeList, Proc_TcxCustomTreeList,BeginUpdateProc_TcxCustomTreeList,EndUpdateProc_TcxCustomTreeList);
finalization
  AcroClassMethodStorage.UnRegisterClassMethod(TcxCustomTreeList);
end.
